<!-- <script type="module" src="SyntaxParser.js" ></script> -->
<script type="module">
  import {parse} from './SyntaxParser.js'
  import {Evaluator} from './evaluator.js'
  document.getElementById('run').addEventListener('click', event =>{
    let tree = parse(document.getElementById('source').value)
    let r = new Evaluator().evaluate(tree)
    console.log(r)
  })
</script>
<textarea id="source" style="width:500px;height:500px">
  //解析var
  var a;
  //解析16进制，八进制，二进制，10进制
  0x14;
  0o24;
  0b10100;
  20;
  //解析字符串
  "广东\n打\t大台风\v"
  //解析Object
  {
    a: 1,b: 2
  };
  //if运算
  a = 1;
  if(a)
    b = a + 1;
  b;
  //while

</textarea>
<!-- onclick="js.evaluate(js.parse(document.getElementById('source').value))" -->
<button id="run" >
  Run
</button>